# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Jan de Groot <jgc@archlinux.org>
# Contributor: Allan McRae <mcrae_allan@hotmail.com>
# Contributor: lp76 <l.peduto@gmail.com>

pkgname=gtk-vnc
pkgver=1.2.0
pkgrel=1
pkgdesc="A VNC viewer widget for GTK+"
url="https://wiki.gnome.org/Projects/gtk-vnc"
arch=(x86_64)
license=(LGPL)
depends=(libgcrypt gtk3 gnutls libpulse)
makedepends=(vala gobject-introspection git perl-text-csv meson)
_commit=e03f3ef68147a8f10f8756d80963bdbfa8f569dc  # tags/v1.2.0^0
source=("git+https://gitlab.gnome.org/GNOME/gtk-vnc.git#commit=$_commit"
        git+https://gitlab.com/keycodemap/keycodemapdb.git)
sha256sums=('SKIP'
            'SKIP')

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/^v//;s/-/+/g'
}

prepare() {
  cd $pkgname

  git submodule init
  git config --local submodule.src/keycodemapdb.url "$srcdir/keycodemapdb"
  git submodule update
}

build() {
  arch-meson $pkgname build
  meson compile -C build
}

check() {
  meson test -C build --print-errorlogs
}

package() {
  DESTDIR="$pkgdir" meson install -C build
  install -Dt "$pkgdir/usr/bin" build/examples/gvncviewer
}
